package com.weixue.dao;

import com.weixue.entity.NongFuMallShoppingCartItem;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Day36
 *      购物车Mapper接口
 */
public interface NongFuMallShoppingCartItemMapper {

    /**
     * 1.添加
     */
    int insert(NongFuMallShoppingCartItem record);

    /**
     * 2.根据用户id和商品id查询
     */
    NongFuMallShoppingCartItem selectByUserIdAndGoodsId
            (@Param("nongFuMallUserId") Long nongFuMallUserId, @Param("goodsId") Long goodsId);

    /**
     * 3.根据用户id查询数量
     */
    int selectCountByUserId(Long nongFuMallUserId);

    /**
     * 4.根据用户id查询
     */
    List<NongFuMallShoppingCartItem> selectByUserId
            (@Param("nongFuMallUserId") Long nongFuMallUserId, @Param("number") int number);

    /**
     * 5.根据主键查询
     */
    NongFuMallShoppingCartItem selectByPrimaryKey(Long cartItemId);

    /**
     * 6.根据主键选择修改
     */
    int updateByPrimaryKeySelective(NongFuMallShoppingCartItem record);

    /**
     * 7.根据主键删除
     */
    int deleteByPrimaryKey(Long cartItemId);

    int insertSelective(NongFuMallShoppingCartItem record);

    int updateByPrimaryKey(NongFuMallShoppingCartItem record);

    int deleteBatch(List<Long> ids);
}